home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / unixlib.lha / unix / test / dup2_test.c < prev    next >
C/C++ Source or Header  |  1995-09-05  |  253b  |  19 lines

  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #include <unistd.h>
  4.  
  5. int
  6. main(void)
  7. {
  8.     int fd;
  9.  
  10.     fd = open("pippo", O_WRONLY | O_CREAT | O_TRUNC, 400);
  11.     write(fd, "pluto\n", 6);
  12.     dup2(fd, 1);
  13.     write(1, "nave\n", 5);
  14.     printf("prua\n");
  15.     close(fd);
  16.     return(0);
  17. }
  18.     
  19.